1 Introduction

Here, we will perform patient- and time-point-specific clustering. If we can indeed predict Richter-like cells at the early stages of the disease, then they should cluster together without having the Richter time-point present. On the other hand, if they were poor-quality cells, then they might scatter everywhere in the absence of a Richter-like cluster.

2 Pre-processing

2.1 Load packages

library(Seurat)
library(tidyverse)

2.2 Define parameters

path_to_obj <- here::here("results/R_objects/patient_63/7.seurat_list_annotated_reprocessed.rds")


# Colors
color_palette <- c("black", "gray", "red", "yellow", "violet", "green4",
                   "blue", "mediumorchid2", "coral2", "blueviolet",
                   "indianred4", "deepskyblue1", "dimgray", "deeppink1",
                   "green", "lightgray", "hotpink1")


# Source functions
source(here::here("bin/utils.R"))

2.3 Load data

seurat_list <- readRDS(path_to_obj)

3 Patient 12

seurat_12 <- seurat_list$`12`
seurat_list_12 <- SplitObject(seurat_12, split.by = "time_point")
seurat_list_12 <- seurat_list_12[sort(unique(seurat_12$time_point))]
seurat_list_12 <- purrr::map(seurat_list_12, process_seurat, dims = 1:20)
umaps_time_points_12 <- purrr::map(
  seurat_list_12,
  DimPlot,
  pt.size = 0.8,
  cols = color_palette
)
umaps_time_points_12
## $T1

## 
## $T2

## 
## $T4

## 
## $T5

## 
## $T6

4 Patient 19

seurat_19 <- seurat_list$`19`
seurat_list_19 <- SplitObject(seurat_19, split.by = "time_point")
seurat_list_19 <- seurat_list_19[sort(unique(seurat_19$time_point))]
seurat_list_19 <- purrr::map(seurat_list_19, process_seurat, dims = 1:20)
umaps_time_points_19 <- purrr::map(
  seurat_list_19,
  DimPlot,
  pt.size = 0.8,
  cols = color_palette
)
umaps_time_points_19
## $T1

## 
## $T3

## 
## $T4

## 
## $T5

## 
## $T6

5 Patient 3299

seurat_3299 <- seurat_list$`3299`
seurat_list_3299 <- SplitObject(seurat_3299, split.by = "time_point")
seurat_list_3299 <- seurat_list_3299[sort(unique(seurat_3299$time_point))]
seurat_list_3299 <- purrr::map(seurat_list_3299, process_seurat, dims = 1:20)
umaps_time_points_3299 <- purrr::map(
  seurat_list_3299,
  DimPlot,
  pt.size = 0.8,
  cols = color_palette
)
umaps_time_points_3299
## $T1

## 
## $T2

## 
## $T3

6 Session Information

sessionInfo()
## R version 4.0.4 (2021-02-15)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.2 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=es_ES.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] forcats_0.5.1      stringr_1.4.0      dplyr_1.0.6        purrr_0.3.4        readr_1.4.0        tidyr_1.1.3        tibble_3.1.2       ggplot2_3.3.3      tidyverse_1.3.0    SeuratObject_4.0.1 Seurat_4.0.1       BiocStyle_2.18.1  
## 
## loaded via a namespace (and not attached):
##   [1] readxl_1.3.1          backports_1.2.1       plyr_1.8.6            igraph_1.2.6          lazyeval_0.2.2        splines_4.0.4         listenv_0.8.0         scattermore_0.7       digest_0.6.27         htmltools_0.5.1.1     fansi_0.4.2           magrittr_2.0.1        tensor_1.5            cluster_2.1.1         ROCR_1.0-11           globals_0.14.0        modelr_0.1.8          matrixStats_0.58.0    spatstat.sparse_2.0-0 colorspace_2.0-1      rvest_1.0.0           ggrepel_0.9.1         haven_2.3.1           xfun_0.22             crayon_1.4.1          jsonlite_1.7.2        spatstat.data_2.1-0   survival_3.2-10       zoo_1.8-9             glue_1.4.2            polyclip_1.10-0       gtable_0.3.0          leiden_0.3.7          future.apply_1.7.0    abind_1.4-5           scales_1.1.1          DBI_1.1.1             miniUI_0.1.1.1        Rcpp_1.0.6            viridisLite_0.4.0     xtable_1.8-4          reticulate_1.20       spatstat.core_2.1-2   htmlwidgets_1.5.3     httr_1.4.2            RColorBrewer_1.1-2    ellipsis_0.3.2        ica_1.0-2             farver_2.1.0          pkgconfig_2.0.3       sass_0.4.0            uwot_0.1.10           dbplyr_2.1.0          deldir_0.2-10        
##  [55] utf8_1.2.1            here_1.0.1            tidyselect_1.1.1      labeling_0.4.2        rlang_0.4.11          reshape2_1.4.4        later_1.2.0           munsell_0.5.0         cellranger_1.1.0      tools_4.0.4           cli_2.5.0             generics_0.1.0        broom_0.7.5           ggridges_0.5.3        evaluate_0.14         fastmap_1.1.0         yaml_2.2.1            goftest_1.2-2         knitr_1.31            fs_1.5.0              fitdistrplus_1.1-3    RANN_2.6.1            pbapply_1.4-3         future_1.21.0         nlme_3.1-152          mime_0.10             xml2_1.3.2            compiler_4.0.4        rstudioapi_0.13       plotly_4.9.3          png_0.1-7             spatstat.utils_2.1-0  reprex_1.0.0          bslib_0.2.5           stringi_1.6.2         highr_0.8             RSpectra_0.16-0       lattice_0.20-41       Matrix_1.3-3          vctrs_0.3.8           pillar_1.6.1          lifecycle_1.0.0       BiocManager_1.30.10   spatstat.geom_2.1-0   lmtest_0.9-38         jquerylib_0.1.4       RcppAnnoy_0.0.18      data.table_1.14.0     cowplot_1.1.1         irlba_2.3.3           httpuv_1.6.1          patchwork_1.1.1       R6_2.5.0              bookdown_0.21        
## [109] promises_1.2.0.1      KernSmooth_2.23-18    gridExtra_2.3         parallelly_1.25.0     codetools_0.2-18      MASS_7.3-53.1         assertthat_0.2.1      rprojroot_2.0.2       withr_2.4.2           sctransform_0.3.2     mgcv_1.8-34           parallel_4.0.4        hms_1.0.0             grid_4.0.4            rpart_4.1-15          rmarkdown_2.7         Rtsne_0.15            shiny_1.6.0           lubridate_1.7.10